﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jb.Search
{
    //public interface IIndexer { }

    public interface IIndexer//<T> where T : class
    {        
        /// <summary>
        /// Builds a Lucene Document from a given Object and adds to the lucene Index
        /// </summary>
        /// <typeparam name="T">This should be the of Resume or Job object, depending on the what has to be indexed.</typeparam>
        /// <param name="obj"></param>
        /// <param name="appName"></param>
        void IndexDocument<T>(T obj, String appName) where T : class;

        /// <summary>
        /// Updates Lucene Index for a given object
        /// </summary>
        /// <typeparam name="T">This should be the of Resume or Job object, depending on the what has to be indexed.</typeparam>
        /// <param name="obj"></param>
        /// <param name="appName"></param>
        void UpdateIndex<T>(T obj, String appName) where T : class;   
     
        /// <summary>
        /// Deletes a Lucene Document from its index
        /// </summary>
        /// <param name="uniqueItemID"></param>
        void DeleteIndex(int uniqueItemID);

        /// <summary>
        /// Closes the Index Writer. Must be called explicitely after an index operation
        /// </summary>
        void CloseWriter();

        /// <summary>
        /// Commits all the changes in a Lucene document into the Disk
        /// </summary>
        void CommitChanges();

        /// <summary>
        /// Optimizes Lucene Index writer
        /// </summary>
        void Optimize();

        /// <summary>
        /// Deletes all the previous lucene documents, and Reindexes them all
        /// </summary>
        /// <returns></returns>
        ReIndexResult ReIndex(int processStatusJobID);
    }    
}
